<?
    $currentCategory = Zend_Controller_Front::getInstance()->getRequest()->getParam('category_id');
    $mapper = new Application_Model_Mapper(new Application_Model_DbTable_RentCategory(), new Application_Model_RentCategory());
    $categories = $mapper->getCollection();
?>
<div>
    <ul>
        <li>Размер загружаемой картинки должен быть 155х155 px</li>
    </ul>
</div>
<form enctype="multipart/form-data" method="POST" action="/save/rent/">
    <input type="hidden" name="form_type" value="<?= Application_Model_Factory::TYPE_RENT; ?> "/>
    <input type="hidden" name="rent_id" value="<?= $this->form->getElement()->getId() ?>"/>
    <input type="hidden" name="photo" value="<?= $this->form->getElement()->getRentPhoto(true) ?>"/>
    <div class="form-data">
        <label for="photo">Фотография:</label>
        <input id="photo" type="file" name="photo" />
    </div>
    <div class="form-data">
        <label for="title">Название:</label>
        <input id="title" type="text" name="title" value="<?= $this->form->getElement()->getRentTitle() ?>" />
    </div>
    <div class="form-data">
        <label for="category">Категория:</label>
        <select id="category" name="category">
            <? foreach ($categories as $category):?>
                <?/** @var Application_Model_RentCategory $category */?>
                <option value="<?= $category->getId();?>" <?if ($category->getId() == $this->form->getElement()->getRentCategory()):?>selected="selected"<? endif; ?>><?=$category->getTitle();?></option>
            <? endforeach; ?>
        </select>
    </div>
    <table class="form-data">
        <tr class="form-data">
            <td><label for="price">Стоимость аренды 1 день:</label></td>
            <td><input id="price" type="text" name="price" value="<?= $this->form->getElement()->getRentPrice() ?>" /></td>
        </tr>
        <tr class="form-data">
            <td><label for="price_more">Стоимость аренды 2 дня и более:</label></td>
            <td><input id="price_more" type="text" name="price_more" value="<?= $this->form->getElement()->getRentPriceMore() ?>" /></td>
        </tr>
        <tr class="form-data">
            <td><label for="bail">Залог:</label></td>
            <td><input id="bail" type="text" name="bail" value="<?= $this->form->getElement()->getRentBail() ?>" /></td>
        </tr>
    </table>
    <div class="form-data">
        <label for="desc">Описание:</label>
        <textarea id="desc" name="desc"><?= $this->form->getElement()->getRentDesc() ?></textarea>
    </div>
    <div class="form-data">
        <label for="is_active">Показывать:</label>
        <input id="is_active" name="is_active" type="checkbox" <?if ($this->form->getElement()->getRentIsActive()):?>checked <? endif; ?> >
    </div>
    <input type="submit" value="Готово" />
</form>